public class Test {
    /* 方法的名称相同，参数列表不同或者类型不同，这就为重载*/
    public static int sum(int a,int b){
        return a+b;
    }
    public  static int sum(int a,int b,int c){
        return a+b+c;
    }
    public  static float sum(float a,float b){
        return a+b;
    }
    public static double sum(double a,double b,double c){
        return a+b+c;
    }
    public static void main(String[] args) {
        int a=2;
        int b=3;
        int c=4;
        System.out.println(sum(a,b));
        System.out.println(sum(a,b,c));
        System.out.println(sum(4.5F,5.5F));
        System.out.println(sum(3.0,5,6.2));

    }

}
